﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
    class Program
    {
        static void tikTok()
        {
            int h = getHour();
            int m = getMinutes();
            int s = getSeconds();
            Console.WriteLine("Thank you Program will start in a moment");
            Thread.Sleep(2000);
            Console.Clear();
            Thread.Sleep(1000);
            while (true)
            {
                if ((h == 23) && (m == 59) && (s == 59))
                {
                    h = 0;
                    m = 0;
                    s = 0;
                }
                else if ((m == 59) && (s == 59))
                {
                    m = 0;
                    s = 0;
                    h++;
                }
                else if (s == 59)
                {
                    s = 0;
                    m++;
                }
                else s++;

                Console.WriteLine(CheckTheOutpt(h) + " : " + CheckTheOutpt(m) + " : " + CheckTheOutpt(s));
                Thread.Sleep(1000);
                Console.Clear();
            }
        }

        static int getHour()
        {
            int h = 0;
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine("Input Hours from 0-23");
                h = Convert.ToInt32(Console.ReadLine());
                if ((h < 0) || (h > 23))
                {
                    Console.WriteLine("Wrong Input");
                }
                else
                {
                    return h;
                }
            }
            Console.WriteLine("You put wrong value 3 times in a row. The value will be set up in 0");
            return h=0;
        }

        static int getSeconds()
        {
            int h = 0;
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine("Input Seconds Value from 0 - 59");
                h = Convert.ToInt32(Console.ReadLine());
                if ((h < 0) || (h > 59))
                {
                    Console.WriteLine("Wrong Input");
                }
                else
                {
                    return h;
                }
            }
            Console.WriteLine("You put wrong value 3 times in a row. The value will be set up in 0");
            return h = 0;
        }

        static int getMinutes()
        {
            int h = 0;
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine("Input Minutes Value from 0-59");
                h = Convert.ToInt32(Console.ReadLine());
                if ((h < 0) || (h > 59))
                {
                    Console.WriteLine("Wrong Input");
                }
                else
                {
                    return h;
                }
            }
            Console.WriteLine("You put wrong value 3 times in a row. The value will be set up in 0");
            return h = 0;
        }

        static string CheckTheOutpt(int a)
        {
            if (a < 10)
            {
                return "0" + Convert.ToString(a);
            }
            else
            {
                return Convert.ToString(a);
            }
        }

        static void Main(string[] args)
        {
            tikTok();
        }

    }
}
